#ifndef __ITRACER_H__
#define __ITRACER_H__
#include "tracer.h"
void disassemble(char *str, int size, uint64_t pc, uint8_t *code, int nbyte);

typedef struct
{
    uint32_t instruction;
    uint64_t pc;
} ITracer_Data;

class ITracer : public Tracer<ITracer_Data, ITRACE_SIZE>
{
    
public:
    ITracer():Tracer("ITracer") {}
    std::string toString(ITracer_Data &data)
    {
        char temp[128];
        char inst_asm[64];
        disassemble(inst_asm, sizeof(inst_asm), data.pc, (uint8_t *)&data.instruction, 4);
        sprintf(temp, "PC:0x%08lx inst:0x%08x\t%s", data.pc, data.instruction,inst_asm);
        return std::string(temp);
    }
};
extern ITracer itracer;
#endif
